<!-- 预约渠道 -->
<template>
  <div class="reservation">
    <div class="container">
      <!-- 标题 -->
      <div class="tit">预约渠道数据统计</div>
      <!-- 数据图 -->
      <div class="echarts" ref="charts"></div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { onMounted, reactive, ref } from 'vue'
/* 引入 echarts */
import * as echarts from 'echarts'
/* echart DOM实例 */
const charts = ref<any>()
/* 需要渲染的echarts数据 */
const reseEcharts = reactive({
  legend: {
    orient: 'vertical',
    left: 0,
    top: '60px',
    textStyle: {
      color: '#fff',
    },
  },
  toolbox: {
    show: true,
    feature: {
      mark: { show: true },
      dataView: { show: true, readOnly: false },
      restore: { show: true },
      saveAsImage: { show: true },
    },
  },
  series: [
    {
      name: 'Nightingale Chart',
      type: 'pie',
      radius: [20, 90],
      center: ['50%', '50%'],
      roseType: 'area',
      itemStyle: {
        borderRadius: 8,
      },
      data: [
        { value: 40, name: '前台买票' },
        { value: 38, name: '支付宝' },
        { value: 32, name: 'QQ' },
        { value: 30, name: '微信' },
        { value: 28, name: '抖音' },
        { value: 26, name: '小红书' },
        { value: 22, name: '哔哩哔哩' },
        { value: 18, name: '电话' },
      ],
    },
  ],
})
/* 初始化echarts */
onMounted(() => {
  /* 获取echarts实例 */
  const myEcharts = echarts.init(charts.value)
  /* 渲染数据 */
  myEcharts.setOption(reseEcharts)
})
</script>
<style lang="scss" scoped>
.reservation {
  width: 100%;
  height: 100%;
  padding-top: 10px;
  .container {
    position: relative;
    width: 100%;
    height: 100%;
    background: url('../../images/dataScreen-main-rb.png') no-repeat;
    background-size: 100% 100%;
    /* 标题 */
    .tit {
      position: absolute;
      top: 10px;
      left: 0;
      width: 100%;
      height: 40px;
      color: #ffff;
      font-size: 22px;
      background: url('../../images/dataScreen-title.png') no-repeat left bottom;
    }
    /* 数据图 */
    .echarts {
      width: 100%;
      height: 100%;
    }
  }
}
</style>
